/**
 * 
 */
package com.alkandros.linesmash.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.alkandros.linesmash.R;
import com.alkandros.linesmash.location.ILocationCallBack;
import com.alkandros.linesmash.ui.signup.PaymentDetails;
import com.alkandros.linesmash.ui.signup.PaymentDetailsCreditCard;
import com.alkandros.linesmash.ui.signup.SignUp;

/**
 * @author Jiju Induchoodan
 *
 */
public class PayNow extends BaseActivity implements OnClickListener,ILocationCallBack {
	private TextView txtProceedGuest;
	private TextView txtSignup;
	private Intent intent;
	private RadioButton radioFirst;
	private RadioButton radioSecond;
	private RelativeLayout relativeCreditCard;
	private RelativeLayout relativeMason;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.payment_options);
		initialiseUI();
	}

	private void initialiseUI()
	{
		setHeading(R.string.payment_options);
		setLeftButton();
		setRightButton();
		txtProceedGuest  		= (TextView)findViewById(R.id.txt_proceed_guest);
		txtSignup		 		= (TextView)findViewById(R.id.btn_signup);
		radioFirst		 		= (RadioButton)findViewById(R.id.radio_first);
		radioSecond		 		= (RadioButton)findViewById(R.id.radio_second);
		relativeCreditCard		= (RelativeLayout)findViewById(R.id.relative_credit_card);
		relativeMason		 	= (RelativeLayout)findViewById(R.id.relative_mason);
		
		txtSignup.setOnClickListener(this);
		txtProceedGuest.setOnClickListener(this);
		radioFirst.setOnClickListener(this);
		radioSecond.setOnClickListener(this);
		relativeCreditCard.setOnClickListener(this);
		relativeMason.setOnClickListener(this);
	}
	@Override
	public void onClick(View v) {
		if(v==txtProceedGuest)
		{
			if(radioFirst.isChecked())
			{
				intent = new Intent(this,PaymentDetailsCreditCard.class);
				 intent.putExtra("checkoutmode", true);
			}
			else 
			{
				intent = new Intent(this,PaymentDetails.class);
				 intent.putExtra("checkoutmode", true);
			}
		   
		  
		   startActivity(intent);
		}
		else if(v==txtSignup)
		{
			intent = new Intent(this,SignUp.class);
			startActivity(intent);
		}
		else if(v==radioFirst)
		{
			radioSecond.setChecked(false);
			radioFirst.setChecked(true);
		}
		else if(v==radioSecond)
		{
			radioSecond.setChecked(true);
			radioFirst.setChecked(false);
		}
		else if(v==relativeCreditCard)
		{
			radioSecond.setChecked(false);
			radioFirst.setChecked(true);
		}
		else if(v==relativeMason)
		{
			radioSecond.setChecked(true);
			radioFirst.setChecked(false);
		}
	}

	/* (non-Javadoc)
	 * @see com.alkandros.linesmash.location.ILocationCallBack#setResult(java.lang.String)
	 */
	@Override
	public void setResult(String address) {
		// TODO Auto-generated method stub
		
	}
	
}
